<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page import="org.apache.shiro.web.filter.authc.FormAuthenticationFilter"%>
<%@ page import="org.apache.shiro.authc.ExcessiveAttemptsException"%>
<%@ page import="org.apache.shiro.authc.IncorrectCredentialsException"%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<html>


<head>
	<title>登录页</title>
	<link href="${ctx}/static/jquery-validation/1.9.0/validate.css" type="text/css" rel="stylesheet" />
<script src="${ctx}/static/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script src="${ctx}/static/jquery-validation/1.9.0/jquery.validate.min.js" type="text/javascript"></script>
<script src="${ctx}/static/jquery-validation/1.9.0/messages_cn.js" type="text/javascript"></script>
	
<style type="text/css">
	div{overflow:hidden; *display:inline-block;}div{*display:block;}
	.login_box{background:url(${ctx}/static/images/admin_img/login_bg.jpg) no-repeat; width:602px; height:416px; overflow:hidden; position:absolute; left:50%; top:50%; margin-left:-301px; margin-top:-208px;}
	.login_iptbox{bottom:90px;_bottom:72px;color:#FFFFFF;font-size:12px;height:30px;left:50%;
    margin-left:-280px;position:absolute;width:560px; overflow:visible;}
	.login_iptbox .ipt{height:24px; width:110px; margin-right:22px; color:#fff; background:url(${ctx}/static/images/admin_img/ipt_bg.jpg) repeat-x; *line-height:24px; border:none; color:#000; overflow:hidden;}
     .login_iptbox .ipt{width:100px; margin-right:12px;}
	.login_iptbox label{ *position:relative; *top:-6px;}
	.login_iptbox .ipt_reg{margin-left:12px;width:46px; margin-right:16px; background:url(${ctx}/static/images/admin_img/ipt_bg.jpg) repeat-x; *overflow:hidden;text-align:left;padding:2px 0 2px 5px;font-size:16px;font-weight:bold;}
	.login_tj_btn{ background:url(${ctx}/static/images/admin_img/login_dl_btn.jpg) no-repeat 0px 0px; width:52px; height:24px; margin-left:16px; border:none; cursor:pointer; padding:0px; float:right;}
	.yzm{position:absolute; background:url(${ctx}/static/images/admin_img/login_ts140x89.gif) no-repeat; width:140px; height:89px;right:56px;top:-96px; text-align:center; font-size:12px; display:none;}
	.yzm a:link,.yzm a:visited{color:#036;text-decoration:none;}
	.yzm a:hover{color:#C30;}
	.yzm img{cursor:pointer; margin:4px auto 7px; width:130px; height:50px; border:1px solid #fff;}
	.cr{font-size:12px;font-style:inherit;text-align:center;color:#ccc;width:100%; position:absolute; bottom:58px;}
	.cr a{color:#ccc;text-decoration:none;}
</style>
	
	<script>
		$(document).ready(function() {
			$("#myform").validate();
		});
		<!--
		if(top!=self)
		if(self!=top) top.location=self.location;
	</script>
</head>

<body onload="javascript:document.myform.username.focus();">
<div id="login_bg" class="login_box">
	<div class="login_iptbox">


	
			 	 <form:form action="${ctx}/login" method="post" name="myform" id="myform">
	<%
	String error = (String) request.getAttribute(FormAuthenticationFilter.DEFAULT_ERROR_KEY_ATTRIBUTE_NAME);
	if(error != null){
	%>
		<div class="control-group">
		<div class="controls ">
		<div class="alert alert-error">
		<button class="close" data-dismiss="alert">×</button>
		登录失败，请重试.</div>
		</div>
		</div>
		
	<%
	}
	%>

	 <input name="dosubmit" value="" type="submit" class="login_tj_btn" /><label>
	 用户名：</label>
	 <input name="username"  id="username" type="text" class="required ipt" value="" />
	 <label>密码：</label>
	 <input name="password" id="password" type="password" class="required ipt" value="" />
	 <label>验证码：</label>
	 <input name="captcha" type="text" class="ipt ipt_reg" onfocus="document.getElementById('yzm').style.display='block'" />
    <div id="yzm" class="yzm"><img src="${ctx}/captcha-image" width="55" height="20" id="code_img" />  <br /><a href="javascript:document.getElementById('code_img').src='${ctx}/captcha-image?'+Math.random();void(0);">单击更换验证码</a></div>
	
	</form:form>
	
	  </div>
	  
    <div class="cr"></div>
</div>
</body>
</html>
